/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = (appInfo) => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = (exports = {});

    // use for cookie sign key, should change to your own and keep security
    config.keys = appInfo.name + '_1606725819677_5007';

    // add your middleware config here
    config.middleware = ['errorHandler'];

    config.swaggerdoc = {
        dirScanner: './app/controller',
        apiInfo: {
            title: '博客系统接口管理',
            description: '遵循 RESTful 规范开发的 API 接口服务',
            version: '1.0.0',
        },
        schemes: ['http'],
        consumes: ['application/json'],
        produces: ['application/json'],
        securityDefinitions: {
            // apikey: {
            //     type: 'apiKey',
            //     name: 'clientkey',
            //     in: 'header',
            // },
            // oauth2: {
            //     type: 'oauth2',
            //     tokenUrl: 'http://petstore.swagger.io/oauth/dialog',
            //     flow: 'password',
            //     scopes: {
            //         'write:access_token': 'write access_token',
            //         'read:access_token': 'read access_token',
            //     },
            // },
        },
        // enableSecurity: false,
        // enableValidate: true,
        routerMap: true,
        enable: true,
    };

    // add your user config here
    const userConfig = {
        // myAppName: 'egg',
        mysql: {
            client: {
                host: 'localhost',
                port: 3306,
                user: 'root',
                password: 'root',
                database: 'zh',
            },
        },
        security: {
            csrf: false,
        },
    };

    return {
        ...config,
        ...userConfig,
    };
};
